{* $Id$ *}
{include_core file="admin/lib/header.html" title="门店设备绑定记录"}
  <div class="page-header border-bottom clearfix">
    <h2 class="left">{if $store_info.status == 1}审核门店{else}门店详情{/if}</h2>
    {if $is_delete == 0}
    <a href="{AnUrl("store/admin?is_delete=1")}" class="btn btn-success btn-sm right">&lt; 返回门店列表</a>
    {/if}
    <a href="{if $store_type == 100}{AnUrl("store/admin/movie_store&is_delete=$is_delete")}{else}{AnUrl("store/admin?is_delete=$is_delete")}{/if}" class="btn btn-default btn-sm right">&lt; {if $store_info.is_delete == 1}{if $store_info['status'] == 1}取消审核{else}返回门店列表{/if}{else}返回回收站列表{/if}</a>
    
    <!-- <a href="{AnUrl('store/admin')}" class="btn btn-default btn-sm right">&lt; {if $store_info['status'] == 1}取消审核{else}返回门店列表{/if}</a> -->
  </div>

<!--   <div class="search-level1 clearfix" {if $is_advenced == 1}style="display:none;"{/if}>
    <form action="store/admin" method="get">
      <input type="hidden" name="is_advenced" value="0">
      <input type="hidden" name="status" value="{$status}">
      <input type="text" class="left" name="search_filter[serial]" value="{$search_filter.serial}" placeholder="序列号">
      <button type="submit" class="btn btn-success btn-sm left">搜索</button>
      <a href="javascript:void(0);" class="close js_advanced {if $is_advenced == 1}js_isOpen open{/if}">高级搜索<em></em></a>
    </form>
  </div>

  <div class="search-form js_advancedForm" {if $is_advenced == 0}style="display:none;"{/if}>
    <form action="store/admin" method="get" class="js_focusSearchForm">
      <input type="hidden" name="is_advenced" value="1">
      <input type="hidden" name="status" value="{$status}">

      <p>
      <label for="" class="search-f-label">添加时间：</label>
        <input type="text" class="search-f-ipt1 search-f-ipt2" name="search_filter[start_date]" value="{$search_filter.start_date}" id="startDate">
        <span class="search-f-line"></span>
        <input type="text" class="search-f-ipt1 search-f-ipt2" name="search_filter[end_date]" value="{$search_filter.end_date}" id="stopDate">
      </p>
      <p><label for="" class="search-f-label"></label><button type="submit" class="btn btn-success btn-xs js_searchBtn">搜索</button></p>
    </form>
  </div> -->

  <!--start:列表-->
  <table class="list-table">
    <thead>
      <tr>
        <th colspan="4">总店信息</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td width="25%" style="font-weight:bold">门店名称</td>
        <td width="25%">{$user_store_info.title}</td>
        <td width="25%" style="font-weight:bold">总店店长</td>
        <td width="25%">{$store_info['owner_name']}</td>
      </tr>
      <tr>
        <td style="font-weight:bold">营业执照</td>
        <td>{if $user_store_info['cert_company']}<a href="{_image($user_store_info['cert_company'])}" target="_blank"><img alt="营业执照" src="{_image($user_store_info['cert_company'], 'store-small')}"></a>{else}暂无营业执照{/if}</td>
        <td style="font-weight:bold">身份证</td>
        <td>{if $user_store_info['cert_idcard_front']}<a href="{_image($user_store_info['cert_idcard_front'])}" target="_blank"><img alt="身份证正面照" src="{_image($user_store_info['cert_idcard_front'], 'store-small')}"></a>{else}暂无身份证正面照{/if}&nbsp;&nbsp;&nbsp;&nbsp;{if $user_store_info['cert_idcard_back']}<a href="{_image($user_store_info['cert_idcard_back'])}" target="_blank"><img alt="身份证背面照" src="{_image($user_store_info['cert_idcard_back'], 'store-small')}"></a>{else}暂无身份证背面照{/if}</td>
      </tr>
    </tbody>
  </table>
  <table class="list-table">
    <thead>
      <tr>
        <th colspan="4">审核门店信息</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td width="25%" style="font-weight:bold">门店名称</td>
        <td width="25%" >{$store_info.store_title}</td>
        <td width="25%" style="font-weight:bold">分店店长</td>
        <td width="25%" >{$store_info.owner_name}</td>
      </tr>
      <tr>
        <td  style="font-weight:bold">签约人员</td>
        <td>{$store_info['sign_user_name']}</td>
        <td  style="font-weight:bold">签约人员的手机号</td>
        <td>{$store_info['sign_user_mobile']}</td>
      </tr>
      <tr>
        <td style="font-weight:bold">签约时间</td>
        <td>{$store_info['sign_time']}</td>
        <td style="font-weight:bold">门店类型</td>
        <td>{$store_info['type']}</td>
      </tr>
      <tr>
        <td style="font-weight:bold">积分</td>
        <td>{$store_info.score}</td>
        <td style="font-weight:bold">门店等级</td>
        <td>{$store_info['level']}</td>
      </tr>
      <tr>
        <td style="font-weight:bold">门店地址</td>
        <td>{$store_info['address']}</td>
        <td style="font-weight:bold">地址坐标</td>
        <td>经度:{$store_info.longitude}<br/>纬度:{$store_info.latitude}</td>
      </tr>
      <tr>
        <td style="font-weight:bold">门店名称</td>
        <td>{$store_info['store_title']}</td>
        <td style="font-weight:bold">门头图</td>
        <td>{if $store_info['cover']}<a href="{_image($store_info['cover'])}" target="_blank"><img src="{_image($store_info['cover'], 'store-small')}"></a>{else}暂无门头图{/if}</td>
      </tr>
    </tbody>
  </table>
  <table class="list-table">
    <!-- <caption>按状态：
      <a href='{AnUrl("store/admin?status=1")}' {if $status == 1} class="label label-primary" {else} class="label label-default" {/if}>正常</a>
      <a href='{AnUrl("store/admin?status=0")}' {if $status == 0} class="label label-primary" {else} class="label label-default" {/if}>已禁用</a>
    </caption> -->
    <thead><tr>
      <th colspan="2">设备绑定信息</th>
    </tr></thead>
    <tbody>
    <tr>
        <td style="min-width:60px;font-weight:bold">设备类型</td>
        <td style="min-width:60px;font-weight:bold">设备序列号</td>
    </tr>
    {foreach $store_info['store_device_list'] as $k=>$v}
        {foreach $v['device_list'] as $key=>$val}
        <tr {if $key%2 == 1} class="bg-gray"{/if}">
        <td>{$v.res_name_str}</td>
        <td>{$val.device_no}</td>
        </tr>
        {/foreach}
    {foreachelse}
          <tr><td class="txtleft" colspan="2">暂无数据</td></tr>
      {/foreach}
    </tbody>
    {if $status == 1}
    <tfoot><tr><td><input type="checkbox" class="selectAll"></td><td colspan="6"><a href="{AnUrl("store/admin/delete")}" class="btn btn-danger btn-xs deleteAll">批量禁用</a></td></tr></tfoot>
    {/if}
  </table>
  <div style="margin-top:10px;">
    {if $store_info['status'] == 1 && $store_info.is_delete != 0}
    <a url="{AnUrl("store/admin/recover_store?id={$store_info.id}")}" class="btn btn-success btn-sm left js_verifyStore"><i class="icon-add"></i>通过审核</a>
    &nbsp;&nbsp;
    {/if}
    <!-- <a url="{AnUrl("store/admin/delete_store?id={$store_info.id}")}" class="btn btn-danger btn-sm{if $store_info.is_delete == 1} js_deleteStore{/if}"><i class="icon-add"></i>{if $store_info.is_delete == 1}删除门店{else}已删除{/if}</a> -->
   </div>
  <script type="text/javascript">
  
  $(function(){
      /* // 声明一个字段映射
      var field_mapping = new Array();
       field_mapping['id'] = '店铺id';
       field_mapping['user_name'] = '分店店长';
       field_mapping['owner_name'] = '总店店长';
       /* field_mapping['agency_name'] = '经销商';
       field_mapping['marketing_name'] = '市场人员'; */
       /* field_mapping['type'] = '门店类型';
       field_mapping['store_title'] = '门店名称';
       field_mapping['cover'] = '门头图';
       field_mapping['store_order'] = '分店序号';
       field_mapping['address'] = '门店地址';
       field_mapping['score'] = '门店积分';
       field_mapping['level'] = '门店等级';
       field_mapping['sign_user_name'] = '签约人员';
       field_mapping['sign_user_mobile'] = '签约人员的手机号';
       field_mapping['sign_time'] = '签约时间'; */
       
       // 设备状态
       var device_status_arr = new Array();
       device_status_arr[0] = '出厂';
       device_status_arr[1] = '损坏';
       device_status_arr[2] = '正常';
       device_status_arr[3] = '停用';
       device_status_arr[404] = '暂无';
       
   // 将指定的元素设置为可视区域居中
      function center_format(obj){
          // 获取可是窗口的宽度
          var winWidth  = $(window).width();
          var winHeight = $(window).height();
          
          // 计算窗体本身的宽和高
          var objWidth = obj.width();
          var objHeight = obj.height();
          
          // 设置窗体的位置
          obj.css('position', 'fixed');
          // 计算left和top值
          var objLeft = (winWidth - objWidth)/2;
          var objTop = (winHeight - objHeight)/2; // 如果除以2感觉不是垂直居中
          obj.css('left', objLeft+'px');
          obj.css('top', objTop+'px');
          
      }
      
    // 高级搜索
    $('.js_advanced').click(function(e){
      e.preventDefault();
      var thisObj = $(this);
      var outBox  = thisObj.closest('form');
      if (thisObj.hasClass('js_isOpen')) {
        thisObj.removeClass('js_isOpen open');
        outBox.find('input').show();
        outBox.find('button').show();
        $('.js_advancedForm').hide();
      } else {
        thisObj.addClass('js_isOpen open');
        outBox.find('input').hide();
        outBox.find('button').hide();
        $('.js_advancedForm').show();
      }
    });
     
    var is_show_confirm = false;
    // 查看门店信息
    $('.js_verifyStore').click(function(){
        if (is_show_confirm) {
            return false;
        }
        // 获取此门店的id
        var url = $(this).attr('url');
        var th = $(this);
        
        $('.float-bg').show();
        var list = $('.js_secondDealerList').clone(true, true);
        
        list.find('.js_verifySuccess').attr('href', '{AnUrl("store/admin/recover_store")}');
        list.find('.js_hiddenStoreId').val('{$store_info.id}');
        $('body').append(list);

        // 设置弹窗的位置
        center_format(list);
        list.show();
        is_show_confirm = true;    
        list.find('.js_closeDealerList').click(function(){
            list.hide();
            list.remove();
            $('.float-bg').hide();
            is_show_confirm = false;
        });
        
        $('.js_verifySuccess').click(function(){
            showMask('正在提交中...', 1);
            var extra = list.find('textarea[name=extra]').val();
            var targetUrl= "{AnUrl("store/admin/recover_store?id={$store_info.id}")}"+"&extra="+extra+'store_type={$store_type}';
            $(this).attr('href', targetUrl);
            is_show_confirm = false;
        });
        
        return false;
    });
    
 // 单个禁用
    $(".js_deleteStore").click(function(){
        var selectId = {$store_info.id};
        if (!selectId) {
          alert('请选择要操作记录');
        }
        var clickObj = $(this);
        var url = clickObj.attr("url");
        var cardListBox = clickObj.closest('.cardListBox');
        showConfirm('确定要删除这家店铺吗？', 1, function(){
          $.post(url, { 'id':selectId }, function(json){
            if (json.info != 'ok') {
              alert(json.info);
            } else {
              showMsg('删除成功!被删除门店可在回收站还原.', 1);
              location.href = '{AnUrl("store/admin")}';
            }
          }, 'json');
        });
        return false;
      });
    
    

  });
  </script>
<div class="float-confirm js_secondDealerList" style="z-index: 20000;display: none; width:auto; height:auto; margin:0px; position : fixed;">
  <div class="float-confirm-con" style="margin:0px 0px;">
    <a class="icon-close js_closeDealerList" href="javascript:void(0);">关闭</a>
    <p style="font-size:18px;color:#23a18b;" class="js_dealerTitle">备注:</p>
    <div style="width:500px;max-height:400px;over-flow:hidden;margin-bottom:15px;">
      <form action="{AnUrl("store/admin/recover_store")}" method="get">
      
      <table style="line-height:50px;width:100%;line-height:24px;margin:0 auto; padding-left:20px;" class="js_refundTable">
        <tr>
          <td>
            <input type="hidden" name="id" value="{$store_info['id']}" class="js_hiddenStoreId" />
            <textarea name="extra" class="add-f-area textarea_box"></textarea>
          </td>
        </tr>
        <tr>
          <td style="text-align:center;padding:10px;" ><a href="javascript:;" class="btn btn-success right js_verifySuccess" ><i class="icon-trash icon-white"></i>确认通过</a></td>
        </tr>
      </table>
      </form>
    </div>
  </div>
</div>
<!-- <div class="float-bg" style="z-index: 19999; display: none"></div> -->
  {include_core file="admin/lib/pager.html"}
<!--end:列表-->
{load_js file='zclip/jquery.zclip.min.js'}
{load_js file='zclip/ZeroClipboard.js'}
{include_core file="admin/lib/footer.html"}